/*
 * @Author: zhangweixin 
 * @Date: 2018-11-13 22:52:46 
 * @Last Modified by: zhangweixin
 * @Last Modified time: 2018-11-14 22:17:40
 */
import {
    COUNTER_INCREMENT,
    COUNTER_DECREMENT,
    COUNTER_RESET
} from '../constants/actionTypes.js';

const initState = {
    count: 0
};

export default function reducer(state = initState,action){
    switch(action.type){
        case COUNTER_INCREMENT:
            return{
                count:state.count+1
            };
        case COUNTER_DECREMENT:
            return{
                count:state.count-1
            };
        case COUNTER_RESET:
            return{
                count:0
            };
        default:
            return state
    }
}